import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_base/12_bottomNavigationBar/home.dart';
import 'package:flutter_base/12_bottomNavigationBar/mine.dart';
import 'package:flutter_base/12_bottomNavigationBar/serch.dart';
import 'package:flutter_base/12_bottomNavigationBar/travel.dart';

class MyTabbar extends StatefulWidget {
  const MyTabbar({super.key});

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _MyTabbarState();
  }
}

class _MyTabbarState extends State<MyTabbar> {
  List<Widget> listPage = [Homepage1(), Mine1(), Search1(), Travel()];
  int _currentIndex = 0;
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: const Text('小米商城'),
      ),
      bottomNavigationBar: BottomNavigationBar(
        type: BottomNavigationBarType.fixed,
        items: const [
          BottomNavigationBarItem(icon: Icon(Icons.home), label: '首页'),
          BottomNavigationBarItem(
              icon: Icon(Icons.camera_enhance), label: '旅拍'),
          BottomNavigationBarItem(icon: Icon(Icons.no_accounts), label: '我的'),
          BottomNavigationBarItem(icon: Icon(Icons.wallet), label: '旅拍'),
        ],
        fixedColor: Colors.orange,
        onTap: (index) {
          print(index);
          setState(() {
            _currentIndex = index;
          });
        },
        currentIndex: _currentIndex,
      ),
      body: listPage[_currentIndex],
    );
  }
}
